<template>
  <div class="defectRecord">
    <base-table :tableSetting="defectRecordConfig"></base-table>
  </div>
</template>

<script>
import { getPatrolDefectList } from "@/api/orderManagement/patrolOrder.js";
export default {
  props: ["orderId"],
  data() {
    return {
      defectRecordConfig: {
        indexShow: true,
        highlightRow: false,
        column: [
          {
            label: "编号",
            textAlign: "center",
            prop: "code",
          },
          {
            label: "标题",
            textAlign: "center",
            prop: "title",
          },
          {
            label: "设备管理单位",
            textAlign: "center",
            prop: "deptManageName",
          },
          {
            label: "设备",
            textAlign: "center",
            prop: "equipmentName",
          },
          {
            label: "缺陷关键字",
            textAlign: "center",
            prop: "keys",
          },
          {
            label: "状态",
            textAlign: "center",
            prop: "status",
            formatter: (row) => {
              return this.$store.getters.fineDirtDataName(
                "order_defect_status",
                row.status
              );
            },
          },
          {
            label: "创建人",
            textAlign: "center",
            prop: "createByName",
          },
          {
            label: "创建时间",
            textAlign: "center",
            prop: "createTime",
          },
        ],
        data: [],
        noBorderRight: false,
        autoHeight: true,
      },
    };
  },
  mounted() {
    this.getTableData();
  },
  methods: {
    getTableData() {
      getPatrolDefectList({ patrolId: this.orderId }).then((res) => {
        if (res.code == 200) {
          this.$set(this.defectRecordConfig, "data", res.data);
        }
      });
    },
  },
};
</script>

<style lang="less" scoped>
.defectRecord {
  width: 100%;
  height: 100%;
}
</style>